﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Media;
using System.Windows;
using System.Threading;
using Microsoft.Research.Kinect.Audio;

namespace Hugo
{
    class Sounds
    {
        public enum Sound { Notification, Navigate, Accept, Reject, Call, IncomingCall, Sent }

        public static SoundPlayer playSound(Sound s)
        {
            return playSound(s, false);
        }

        public static SoundPlayer playSound(Sound s, Boolean looping) {

            if (GlobalSettings.soundMuted) { return null; }

            SoundPlayer sound = null;

            switch (s)
            {
                case Sound.Accept:
                    sound = new SoundPlayer(Properties.Resources.Xbox360_power_on);
                    break;
                case Sound.Reject:
                    sound = new SoundPlayer(Properties.Resources.apple_smsreceived);
                    break;
                case Sound.Notification:
                    sound = new SoundPlayer(Properties.Resources.apple_smsreceived);
                    break;
                case Sound.Navigate:
                    sound = new SoundPlayer(Properties.Resources._779__vitriolix__chick_corkscrew);
                    break;
                case Sound.IncomingCall:
                    sound = new SoundPlayer(Properties.Resources.incomingcall);
                    break;
                case Sound.Call:
                    sound = new SoundPlayer(Properties.Resources.outgoingcall);
                    break;
                case Sound.Sent:
                    sound = new SoundPlayer(Properties.Resources.apple_smsreceived);
                    break; 
            }

            if (sound != null)
            {
                if (looping)
                {
                    sound.PlayLooping();
                }
                else
                {
                    sound.Play();
                }
            }
            return sound;
        }

        internal static void speakMessageAsync(string p)
        {
            if (GlobalSettings.soundMuted) return;

            System.Speech.Synthesis.SpeechSynthesizer reader = new System.Speech.Synthesis.SpeechSynthesizer();
            reader.SpeakAsync(p);
        }

        internal static void speakMessage(string p)
        {
            if (GlobalSettings.soundMuted) return;

            System.Speech.Synthesis.SpeechSynthesizer reader = new System.Speech.Synthesis.SpeechSynthesizer();
            reader.Speak(p);
        }

       
    }
}
